package com.hancher.common.androidutil;

import android.os.Build;
import android.os.Environment;

import androidx.annotation.RequiresApi;

import com.hancher.common.base.BaseApplication;

import java.io.File;

/**
 * 作者 : Hancher ytu_shaoweijie@163.com <br/>
 * 时间 : 2021/8/29 0029 0:45 <br/>
 * 描述 : 文件位置 <br/>
 * externalAppCacheDir          /storage/emulated/0/Android/data/com.hancher.gamelife/cache
 * externalAppCacheFilesDir     /storage/emulated/0/Android/data/com.hancher.gamelife/cache/files
 * externalAppFileDir           /storage/emulated/0/Android/data/com.hancher.gamelife/files
 * externalAppFileImageDir      /storage/emulated/0/Android/data/com.hancher.gamelife/files/image
 * externalAppBackupDir         /storage/emulated/0/Android/data/com.hancher.gamelife/files/backup
 * externalAppBackupDbDir       /storage/emulated/0/Android/data/com.hancher.gamelife/files/backup/db
 * externalAppBackupDb          /storage/emulated/0/Android/data/com.hancher.gamelife/files/backup/db/Hancher.db
 * innerDB                      /data/data/com.hancher.gamelife/databases/Hancher.db
 * innerDbDir                   /data/data/com.hancher.gamelife/databases
 * sdDownload                   /storage/emulated/0/Download                        @Deprecated
 * sdDownloadHancher            /storage/emulated/0/Download/Hancher                @Deprecated
 * sdDownloadHancherZip         /storage/emulated/0/Download/Hancher/backup.zip    @Deprecated
 * sdHancher                    /storage/emulated/0/Hancher                         @Deprecated
 * sdHancherBackupZip           /storage/emulated/0/Hancher/backup.zip             @Deprecated
 * sdHancherAppBackupDb         /storage/emulated/0/Hancher/backup/db/Hancher.db    @Deprecated
 * <p>
 * /storage/emulated/0/Android/data/com.hancher.gamelife/backup  备份文件临时组装的文件夹
 * /storage/emulated/0/Download/Hancher 备份文件路径
 * /data/data/com.hancher.gamelife/databases/ 内部数据库文件夹
 * /apps/GameLife/ 百度网盘备份路径
 */
public class PathUtil {
    public static String DB_NAME = "GameLife";


    //内部存储 /data/data/com.hancher.gamelife/
    public static String IN_DB = BaseApplication.getInstance().getDatabasePath(DB_NAME).getParent();

    //region 外部公共存储 /storage/emulated/0/
    public static String OUT_PUBLIC_ROOT = Environment.getExternalStorageDirectory().getAbsolutePath();
    public static String OUT_PUBLIC_DOWNLOAD = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
    public static String OUT_PUBLIC_DCIM = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath();
    public static String OUT_PUBLIC_MOVIES = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath();
    public static String OUT_PUBLIC_MUSICS = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath();
    public static String OUT_PUBLIC_DOCUMENTS = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath();
    public static String OUT_PUBLIC_PICTURES = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath();
    public static String OUT_PUBLIC_DOWNLOAD_Hancher = OUT_PUBLIC_DOWNLOAD + File.separator + "Hancher";
    /**
     * 闹铃
     */
    public static String OUT_PUBLIC_ALARMS = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_ALARMS).getAbsolutePath();
    /**
     * 铃声
     */
    public static String OUT_PUBLIC_RINGTONES = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RINGTONES).getAbsolutePath();
    /**
     * 通知
     */
    public static String OUT_PUBLIC_NOTIFICATIONS = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_NOTIFICATIONS).getAbsolutePath();
    /**
     * 博客，类似收音机
     */
    public static String OUT_PUBLIC_PODCASTS = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PODCASTS).getAbsolutePath();
    /**
     * 截图
     */
    @RequiresApi(api = Build.VERSION_CODES.Q)
    public static String OUT_PUBLIC_SCREENSHOTS = null;
    /**
     * 有声书
     */
    @RequiresApi(api = Build.VERSION_CODES.Q)
    public static String OUT_PUBLIC_AUDIOBOOKS = null;

    static {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            OUT_PUBLIC_SCREENSHOTS = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_SCREENSHOTS).getAbsolutePath();
            OUT_PUBLIC_AUDIOBOOKS = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_AUDIOBOOKS).getAbsolutePath();
        }
    }
    //endregion

    // region 外部应用存储 /storage/emulated/0/Android/data/com.hancher.gamelife/
    /**
     * /storage/emulated/0/Android/data/com.hancher.gamelife/cache
     */
    public static String OUT_APP_CACHE = BaseApplication.getInstance().getExternalCacheDir().getAbsolutePath();
    /**
     * /storage/emulated/0/Android/data/com.hancher.gamelife/file
     */
    public static String OUT_APP_FILE = BaseApplication.getInstance().getExternalFilesDir(null).getAbsolutePath();
    // endregion

}
